package com.zhen.redis.web;


import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class redisController {
    @Resource
    private RedisTemplate redisTemplate;

    @PostMapping("/xiaomei")
    public String getXiaoMeiName() {
        redisTemplate.opsForValue().set("name", "xiaomei");
        String name = (String) redisTemplate.opsForValue().get("name");
        log.info("xiaomei的名字是{}", name);
        return name;
    }
}
